package com.luoyx.hauyne.audit.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.luoyx.hauyne.admin.api.sys.request.UserProfileUpdatedMsg;
import com.luoyx.hauyne.audit.entity.UserProfile;
import com.luoyx.hauyne.mybatisplus.mapper.GenericMapper;

/**
 * <p>
 * 用户资料表 Mapper 接口
 * </p>
 *
 * @author Alan.Luo
 * @since 2024-09-25
 */
public interface UserProfileMapper extends GenericMapper<UserProfile> {

    default void updateFullName(UserProfileUpdatedMsg userProfileUpdatedMsg) {
        update(null,
                Wrappers.<UserProfile>lambdaUpdate()
                        .set(UserProfile::getFullName, userProfileUpdatedMsg.getFullName())
                        .eq(UserProfile::getUserId, userProfileUpdatedMsg.getUserId())
        );
    }
}
